{template 'common/header'}
<script>
    $(function(){
        $(".del").on('click',function(){
            if(confirm('是否确认删除该服务社？')){
                var id = $(this).attr('server_id');
                if(id > 0){
                    var url = "{php echo $this->createWebUrl('express',array('op' => 'server_del'))}";
                    $.ajax({
                        type : 'post',
                        url : url,
                        data : {'id' : id},
                        success : function(data){
                            if(data == 111){
                                location.reload();
                            }else{
                                alert(data);
                            }
                        }
                    });
                }
            }
        });
    });
</script>
<ul class="nav nav-tabs">
    <li ><a href="{php echo $this->createWebUrl('express', array('op'=>'order_list'))}">快递订单</a></li>
    <li ><a href="{php echo $this->createWebUrl('express', array('op'=>'add'))}">添加订单</a></li>
    <li ><a href="{php echo $this->createWebUrl('express', array('op'=>'company'))}">快递公司管理</a></li>
    <li class="active"><a href="{php echo $this->createWebUrl('express', array('op'=>'server'))}">服务社管理</a></li>
</ul>
<div>
    <div style="padding-bottom: 20px;">
        <a href="{php echo $this->createWebUrl('express',array('op' => 'server_add'))}">
            <button class="btn btn-primary">添加服务社</button>
        </a>
    </div>

    <div>
        <table class="table">
            <tr>
                <th>服务社</th>
                <th>电话</th>
                <th>提成比率</th>
                <th>负责区域</th>
                <th>代码</th>
                <th>备注</th>
                <th>操作</th>
            </tr>
            {loop $servers $server}
            <tr>
                <td>{$server['name']}</td>
                <td>{$server['phone']}</td>
                <td>{$server['percent']}</td>
                <td>{$server['regions']}</td>
                <td>{$server['code']}</td>
                <td>{$server['remark']}</td>
                <td>
                    <a href="{php echo $this->createWebUrl('express',array('op' => 'server_add','id' => $server['id']))}">
                        <button class="btn btn-primary">修改</button>
                    </a>
                    <button class="btn btn-danger del" server_id="{$server['id']}">删除</button>
                </td>
            </tr>
            {/loop}
        </table>
    </div>
</div>




{template 'common/footer'}